Skip to content

Conversation

@35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Dec 6, 2025

Closes: #155

  • This PR introduces a method for claude to remove the coder's report task tool call.

@35C4n0r 35C4n0r self-assigned this Dec 6, 2025
@35C4n0r 35C4n0r marked this pull request as draft December 6, 2025 16:32
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

✅ Preview binaries are ready!

To test with modules: agentapi_version = "agentapi_157" or download from: https://github.com/coder/agentapi/releases/tag/agentapi_157

@35C4n0r 35C4n0r requested review from mafredri and matifali December 7, 2025 13:06
@35C4n0r 35C4n0r marked this pull request as ready for review December 7, 2025 13:06
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this will remove tool calls entirely from message history as well? Would it be valuable to keep them around, but as a different type of message, or under a new endpoint?

For debuggability, I could see them being useful.

@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Dec 8, 2025

If I understand correctly, this will remove tool calls entirely from message history as well? Would it be valuable to keep them around, but as a different type of message, or under a new endpoint?

For debuggability, I could see them being useful.

Makes sense to keep them around for debugging, imo we can just log them for now - this should be enough for our usecase as the logs are stored in agentapi-start.log in our workspaces.
WDYT @mafredri

@mafredri
Copy link
Member

mafredri commented Dec 8, 2025

Makes sense to keep them around for debugging, imo we can just log them for now - this should be enough for our usecase as the logs are stored in agentapi-start.log in our workspaces. WDYT @mafredri

Reasonable 👍🏻

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last concern, but otherwise LGTM 👍🏻


if strings.HasPrefix(line, "● coder - coder_report_task (MCP)") {
toolCallStartIdx = i
} else if toolCallStartIdx != -1 && strings.HasPrefix(line, "●") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that ● coder - coder_report_task (MCP) is the last entry, and there won't be a next message with ? In which I assume we'd remove all the remaining lines?

Asking because I don't see handling for this case (unless I'm just missing it).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that ● coder - coder_report_task (MCP) is the last entry, and there won't be a next message with ●? In which I assume we'd remove all the remaining lines?

@mafredri
Added the logic to handle this case. This handles the case where this is the last thing claude outputs is the tool call, and it also acts as a failsafe if the next new message is not prefixed with ●.
I'm checking for a newline after the tool-call and not directly using len(lines) in above case, because I never want to run into this: In which I assume we'd remove all the remaining lines?

@matifali
Copy link
Member

matifali commented Dec 8, 2025

Thanks for the quick fix here Jay.
Let's update Claude's code module to use this new version when it lands.
@david-fraley can inform the customer

@35C4n0r 35C4n0r requested a review from mafredri December 8, 2025 17:03
@35C4n0r 35C4n0r merged commit 90486c5 into coder:main Dec 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Filter out task reporting mcp server calls in chat view

3 participants